import request from '@/utils/request'

const path = "opportunity_rules"

// 查询 线上小组部门商机分配规则
export function listRules(query) {
  return request({
    url: path + '/listAll',
    method: 'get',
    params: query
  })
}
// 查询 线上公共商机分配规则
export function listAllByPublic(query) {
  return request({
    url: path + '/listAllByPublic',
    method: 'get',
    params: query
  })
}
// 查询 线下渠道商机分配规则
export function listAllByOffline(query) {
  return request({
    url: path + '/listAllByOffline',
    method: 'get',
    params: query
  })
}

export function getRules(id) {
  return request({
    url: path + id,
    method: 'get'
  })
}

// 新增 线上小组部门商机分配规则
export function addRules(data) {
  return request({
    url: path,
    method: 'post',
    data: data
  })
}

// 新增 线上小组部门商机分配规则
export function addPublicRules(data) {
  return request({
    url: path + "/addPublicRules",
    method: 'post',
    data: data
  })
}

// 新增 线下渠道商机分配规则
export function addOfflineRules(data) {
  return request({
    url: path + "/addOfflineRules",
    method: 'post',
    data: data
  })
}

export function updateRules(data) {
  return request({
    url: path,
    method: 'put',
    data: data
  })
}

export function delRules(id) {
  return request({
    url: path + id,
    method: 'delete'
  })
}
